<?php
namespace app\admin\controller\v1;

use app\admin\validate\CreateRole;
use app\common\model\Role as RoleModel;

class Role extends BaseController
{
    public function getAll()
    {
        $role_list = RoleModel::getAll();
        return successReturn($role_list);
    }
    public function deleteOne($id){
        RoleModel::deleteOne($id);
        return successReturn();
    }
    public function createOne(){
        $validate = new CreateRole();
        //验证
        $validate->goCheck();
        $data = $validate->request->post();
        RoleModel::createOne($data);
        return successReturn();
    }
    public function updateOne($id){
        $data = input('put.');
        RoleModel::updateOne($id,$data);
        return successReturn();
    }
}
